<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QObjectCleanupHandler Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QObjectCleanupHandler Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QObjectCleanupHandler class watches the lifetime of multiple QObjects. <a href="#details">More...</a></p>
<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qobjectcleanuphandler.html#QObjectCleanupHandler">__init__</a></b> (<i>self</i>)</li><li><div class="fn" />QObject <b><a href="qobjectcleanuphandler.html#add">add</a></b> (<i>self</i>, QObject)</li><li><div class="fn" /><b><a href="qobjectcleanuphandler.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qobjectcleanuphandler.html#isEmpty">isEmpty</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qobjectcleanuphandler.html#remove">remove</a></b> (<i>self</i>, QObject)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QObjectCleanupHandler class watches the lifetime of multiple QObjects.</p>
<p>A QObjectCleanupHandler is useful whenever you need to know when a number of <a href="qobject.html">QObject</a>s that are owned by someone else have been deleted. This is important, for example, when referencing memory in an application that has been allocated in a shared library.</p>
<p>To keep track of some <a href="qobject.html">QObject</a>s, create a QObjectCleanupHandler, and <a href="qobjectcleanuphandler.html#add">add</a>() the objects you are interested in. If you are no longer interested in tracking a particular object, use <a href="qobjectcleanuphandler.html#remove">remove</a>() to remove it from the cleanup handler. If an object being tracked by the cleanup handler gets deleted by someone else it will automatically be removed from the cleanup handler. You can delete all the objects in the cleanup handler with <a href="qobjectcleanuphandler.html#clear">clear</a>(), or by destroying the cleanup handler. <a href="qobjectcleanuphandler.html#isEmpty">isEmpty</a>() returns true if the QObjectCleanupHandler has no objects to keep track of.</p>
<p>See also <a href="qpointer.html">QPointer</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QObjectCleanupHandler" />QObjectCleanupHandler.__init__ (<i>self</i>)</h3><p>Constructs an empty <a href="qobjectcleanuphandler.html">QObjectCleanupHandler</a>.</p>
<a name="//apple_ref/cpp/instm/QObjectCleanupHandler/~QObjectCleanupHandler" />
<h3 class="fn"><a name="add" /><a href="qobject.html">QObject</a> QObjectCleanupHandler.add (<i>self</i>, <a href="qobject.html">QObject</a>)</h3><p>Adds <i>object</i> to this cleanup handler and returns the pointer to the object.</p>
<p>See also <a href="qobjectcleanuphandler.html#remove">remove</a>().</p>
<a name="//apple_ref/cpp/instm/QObjectCleanupHandler/clear" />
<h3 class="fn"><a name="clear" />QObjectCleanupHandler.clear (<i>self</i>)</h3><p>Deletes all objects in this cleanup handler. The cleanup handler becomes empty.</p>
<p>See also <a href="qobjectcleanuphandler.html#isEmpty">isEmpty</a>().</p>
<a name="//apple_ref/cpp/instm/QObjectCleanupHandler/isEmpty" />
<h3 class="fn"><a name="isEmpty" />bool QObjectCleanupHandler.isEmpty (<i>self</i>)</h3><p>Returns true if this cleanup handler is empty or if all objects in this cleanup handler have been destroyed; otherwise return false.</p>
<p>See also <a href="qobjectcleanuphandler.html#add">add</a>(), <a href="qobjectcleanuphandler.html#remove">remove</a>(), and <a href="qobjectcleanuphandler.html#clear">clear</a>().</p>
<a name="//apple_ref/cpp/instm/QObjectCleanupHandler/remove" />
<h3 class="fn"><a name="remove" />QObjectCleanupHandler.remove (<i>self</i>, <a href="qobject.html">QObject</a>)</h3><p>Removes the <i>object</i> from this cleanup handler. The object will not be destroyed.</p>
<p>See also <a href="qobjectcleanuphandler.html#add">add</a>().</p>
<p /><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.7.1-5014f7c72a58 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.1</td></tr></table></div></address></body></html>